<template>
  <div class="common-body">
    <!--  顶部面包屑  -->
    <div class="ccui-navigation">
      <el-button
        size="mini"
        type="primary-icon-medium"
        icon="icon-ccui-return"
        @click="handleBack"
        >返回
      </el-button>
      <div class="ccui-navigation-divider" />
      <!-- 面包屑 -->
      <el-breadcrumb
        class="ccui-navigation-crumbs-container"
        separator-class="el-icon-arrow-right"
      >
        <el-breadcrumb-item
          :to="{ path: $store.getters.getBreadcrumb('level1').path }"
          >{{ $store.getters.getBreadcrumb("level1").name }}
        </el-breadcrumb-item>
        <el-breadcrumb-item :to="{ path: '/invoice/Entering/toSubmit' }"
          >发票管理
        </el-breadcrumb-item>
        <el-breadcrumb-item
          v-if="$route.query.type === 'approval'"
          :to="{
            path: '/invoice/invoiceApproval/pending-list'
          }"
          >发票审批
        </el-breadcrumb-item>
        <el-breadcrumb-item
          v-else
          :to="{
            path: '/invoice/Entering/toSubmit'
          }"
          >发票录入
        </el-breadcrumb-item>
        <el-breadcrumb-item>
          <span>查看</span>
          <span style="margin-left: 10px; color: #4a4a4a">{{
            this.$route.query.invoiceName
          }}</span>
        </el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div :class="commonStyle" v-show="isTrue">
      <div
        class="detail-info"
        :style="{
          width: approvalwidth
        }"
      >
        <div class="detail-info-el-Label">
          <el-label :type="approving" v-if="approvingStatus"></el-label>
        </div>
        <div class="detail-info-form-container self-container">
          <el-tabs v-model="activeName" class="el-tabs__customize">
            <el-tab-pane label="基本信息" name="a">
              <detailBaseInfo
                labelWidth="130px"
                :formList="baseFormList"
                :detail="detailList"
              />
            </el-tab-pane>

            <el-tab-pane label="发票清单" name="b">
              <el-group-title class="ccui-group-wrapper d_jump">
                <template slot="groupTitle">
                  <div class="ccui-multifunctional-table-wrapper">
                    <el-table
                      :data="tableBill"
                      style="margin-bottom: 20px; width: 100%"
                      class="ccui-form-child-table"
                      border
                      ref="multipleTable"
                      :summary-method="getSummaries"
                      lazy
                      show-summary
                      max-height="9999"
                    >
                      <!-- <el-table-column type="selection" width="55" /> -->
                      <el-table-column
                        label="序号"
                        type="index"
                        width="50"
                        fixed
                      />
                      <el-table-column
                        show-overflow-tooltip
                        prop="storageCode"
                        label="入库单编号"
                        width="150"
                      >
                        <template slot-scope="scope">
                          <span>{{ scope.row.storageCode }}</span>
                        </template>
                      </el-table-column>

                      <el-table-column
                        show-overflow-tooltip
                        prop="storageName"
                        label="入库单名称"
                        width="300"
                      >
                        <template slot-scope="scope">
                          <span>{{ scope.row.storageName }}</span>
                        </template>
                      </el-table-column>

                      <el-table-column
                        show-overflow-tooltip
                        prop="materialsCode"
                        label="设备物资编码"
                        width="300"
                      >
                        <template slot-scope="scope">
                          <span>{{ scope.row.materialsCode }}</span>
                        </template>
                      </el-table-column>

                      <el-table-column
                        show-overflow-tooltip
                        prop="materialsName"
                        label="设备物资名称"
                        width="300"
                      >
                        <template slot-scope="scope">
                          <span>{{ scope.row.materialsName }}</span>
                        </template>
                      </el-table-column>

                      <el-table-column
                        show-overflow-tooltip
                        prop="materialsDescribe"
                        label="设备物资说明"
                        width="300"
                      >
                        <template slot-scope="scope">
                          <span>{{ scope.row.materialsDescribe }}</span>
                        </template>
                      </el-table-column>

                      <el-table-column
                        show-overflow-tooltip
                        prop="currentMeasuringUnit"
                        label="计量单位"
                        min-width="90"
                      >
                      </el-table-column>

                      <el-table-column
                        show-overflow-tooltip
                        prop="currentNum"
                        label="数量"
                        min-width="100"
                        header-align="left"
                        :formatter="currentNum"
                      >
                      </el-table-column>
                      <el-table-column
                        show-overflow-tooltip
                        prop="unitPriceWithoutTax"
                        label="不含税单价"
                        width="130"
                        header-align="left"
                        align="right"
                        :formatter="unitPriceWithoutTax"
                      >
                      </el-table-column>
                      <el-table-column
                        show-overflow-tooltip
                        prop="price"
                        label="含税单价"
                        width="130"
                        header-align="left"
                        align="right"
                        :formatter="price"
                      >
                      </el-table-column>
                      <el-table-column
                        show-overflow-tooltip
                        prop="ratePercent"
                        label="税率"
                        min-width="110"
                        width="100"
                        header-align="left"
                        align="right"
                      >
                      </el-table-column>

                      <el-table-column
                        show-overflow-tooltip
                        prop="amountExcludeTax"
                        label="不含税金额"
                        width="130"
                        header-align="left"
                        align="right"
                        :formatter="amountExcludeTax"
                      >
                      </el-table-column>

                      <el-table-column
                        show-overflow-tooltip
                        prop="tax"
                        label="税额"
                        width="130"
                        header-align="left"
                        align="right"
                        :formatter="tax"
                      >
                      </el-table-column>

                      <el-table-column
                        show-overflow-tooltip
                        prop="amount"
                        label="含税金额"
                        width="130"
                        align="right"
                        header-align="left"
                        :formatter="amount"
                      >
                      </el-table-column>

                      <el-table-column
                        show-overflow-tooltip
                        prop="remark"
                        label="备注"
                        width="100"
                      >
                      </el-table-column>
                    </el-table>
                  </div>
                </template>
              </el-group-title>
            </el-tab-pane>
            
            <el-tab-pane label="款项明细" name="c">
              <el-group-title class="ccui-group-wrapper d_jump">
                <template slot="groupTitle">
                  <div class="ccui-multifunctional-table-wrapper">
                    <el-table
                      :data="paymentDetail"
                      style="margin-bottom: 20px; width: 100%"
                      class="ccui-form-child-table"
                      border
                      lazy
                      ref="tableList"
                    >
                      <el-table-column
                        label="序号"
                        type="index"
                        width="55"
                        fixed
                      />
                      <el-table-column
                        :show-overflow-tooltip="true"
                        prop="changeValue"
                        label="变动"
                        width="200"
                      >
                        <template slot-scope="scope">
                          <span>{{ scope.row.changeValue }}</span>
                        </template>
                      </el-table-column>

                      <el-table-column
                        :show-overflow-tooltip="true"
                        prop="paymentNameValue"
                        label="款项名称"
                        width="200"
                      >
                        <template slot-scope="scope">
                          <span>{{ scope.row.paymentNameValue }}</span>
                        </template>
                      </el-table-column>

                      <el-table-column
                        :show-overflow-tooltip="true"
                        prop="specialProjectValue"
                        label="专项项目"
                        width="150"
                      >
                        <template slot-scope="scope">
                          <span>{{ scope.row.specialProjectValue }}</span>
                        </template>
                      </el-table-column>
                      <el-table-column
                        :show-overflow-tooltip="true"
                        prop="receivablePayableNo"
                        label="应收应付编号"
                        width="200"
                        align="right"
                        header-align="left"
                      >
                        <template slot-scope="scope">
                          <span>{{ scope.row.receivablePayableNo }}</span>
                        </template>
                      </el-table-column>

                      <el-table-column
                        :show-overflow-tooltip="true"
                        prop="unWrittenOffOriginalAmount"
                        label="未核销金额（原币）"
                        width="200"
                        align="right"
                        header-align="left"
                      >
                        <template slot-scope="scope">
                          <span>{{
                            scope.row.unWrittenOffOriginalAmount
                          }}</span>
                        </template>
                      </el-table-column>

                      <el-table-column
                        :show-overflow-tooltip="true"
                        prop="originalCurrencyValue"
                        label="原币币种"
                        width="200"
                      >
                        <template slot-scope="scope">
                          <span>{{ scope.row.originalCurrencyValue }}</span>
                        </template>
                      </el-table-column>

                      <el-table-column
                        :show-overflow-tooltip="true"
                        prop="exchangeRate"
                        label="汇率"
                        width="150"
                        header-align="left"
                        align="right"
                      >
                        <template slot-scope="scope">
                          <span>{{ scope.row.exchangeRate }}</span>
                        </template>
                      </el-table-column>

                      <el-table-column
                        :show-overflow-tooltip="true"
                        prop="originalAmount"
                        label="金额（原币）"
                        width="150"
                        header-align="left"
                        align="right"
                      >
                        <template slot-scope="scope">
                          <span>{{ scope.row.originalAmount }}</span>
                        </template>
                      </el-table-column>

                      <el-table-column
                        :show-overflow-tooltip="true"
                        prop="standardAmount"
                        label="金额（本位币）"
                        width="150"
                        header-align="left"
                        align="right"
                      >
                        <template slot-scope="scope">
                          <span>{{ scope.row.standardAmount }}</span>
                        </template>
                      </el-table-column>

                      <el-table-column
                        :show-overflow-tooltip="true"
                        prop="dueDate"
                        label="到期日期"
                        width="150"
                      >
                        <template slot-scope="scope">
                          <span>{{ scope.row.dueDate }}</span>
                        </template>
                      </el-table-column>

                      <el-table-column
                        :show-overflow-tooltip="true"
                        prop="expectPayDate"
                        label="预计付款日期"
                        width="150"
                      >
                        <template slot-scope="scope">
                          <span>{{ scope.row.expectPayDate }}</span>
                        </template>
                      </el-table-column>

                      <el-table-column
                        :show-overflow-tooltip="true"
                        prop="contactNatureValue"
                        label="往来性质"
                        width="200"
                      >
                        <template slot-scope="scope">
                          <span>{{ scope.row.contactNatureValue }}</span>
                        </template>
                      </el-table-column>

                      <el-table-column
                        :show-overflow-tooltip="true"
                        prop="contactOrgName"
                        label="往来单位"
                        width="213"
                      >
                        <template slot-scope="scope">
                          <span>{{ scope.row.contactOrgName }}</span>
                        </template>
                      </el-table-column>

                      <el-table-column
                        :show-overflow-tooltip="true"
                        prop="contactUserName"
                        label="个人"
                        width="150"
                      >
                        <template slot-scope="scope">
                          <span>{{ scope.row.contactUserName }}</span>
                        </template>
                      </el-table-column>

                      <el-table-column
                        :show-overflow-tooltip="true"
                        prop="remark"
                        label="备注"
                        width="150"
                      >
                        <template slot-scope="scope">
                          <span>{{ scope.row.remark }}</span>
                        </template>
                      </el-table-column>
                    </el-table>
                  </div>
                </template>
              </el-group-title>
            </el-tab-pane>
            <el-tab-pane label="发票信息" name="d">
              <el-group-title class="ccui-group-wrapper d_jump">
                <template slot="groupTitle">
                  <div class="ccui-multifunctional-table-wrapper">
                    <el-table
                      :data="billInfo"
                      style="margin-bottom: 20px; width: 100%"
                      class="ccui-form-child-table"
                      border
                      :header-cell-class-name="must"
                      max-height="9999"
                      :summary-method="getSummariesInfo"
                      lazy
                      show-summary
                    >
                      <!-- <el-table-column type="selection" width="55" /> -->
                      <el-table-column
                        label="序号"
                        type="index"
                        width="55"
                        fixed
                      />
                      <el-table-column
                        show-overflow-tooltip
                        prop="invoiceTypeName"
                        label="发票类型"
                        min-width="100"
                        fixed
                      >
                      </el-table-column>

                      <el-table-column
                        show-overflow-tooltip
                        prop="invoiceNo"
                        label="发票号码"
                        min-width="130"
                      >
                      </el-table-column>

                      <el-table-column
                        show-overflow-tooltip
                        prop="invoiceCode"
                        label="发票代码"
                        min-width="130"
                      >
                      </el-table-column>

                      <!-- <el-table-column
                        show-overflow-tooltip
                        prop="ratePercent"
                        label="税率"
                        min-width="100"
                        header-align="left"
                        align="right"
                      >
                      </el-table-column> -->

                      <el-table-column
                        show-overflow-tooltip
                        prop="priceTaxTotal"
                        label="价税合计"
                        min-width="130"
                        header-align="left"
                        align="right"
                        :formatter="priceTaxTotal"
                      >
                      </el-table-column>

                      <el-table-column
                        show-overflow-tooltip
                        prop="tax"
                        label="税额"
                        min-width="130"
                        header-align="left"
                        align="right"
                        :formatter="tax"
                      >
                      </el-table-column>

                      <el-table-column
                        show-overflow-tooltip
                        prop="amountExcludeTax"
                        label="不含税金额"
                        min-width="130"
                        header-align="left"
                        align="right"
                        :formatter="amountExcludeTax"
                      >
                      </el-table-column>

                      <el-table-column
                        show-overflow-tooltip
                        prop="invoiceDate"
                        label="开票日期"
                        min-width="150"
                      >
                        <template slot-scope="scope">
                          <span>{{ scope.row.invoiceDate | filterDate }}</span>
                        </template>
                      </el-table-column>

                      <el-table-column
                        show-overflow-tooltip
                        prop="seller"
                        label="销售方名称"
                        min-width="150"
                      ></el-table-column>

                      <el-table-column
                        show-overflow-tooltip
                        prop="purchaser"
                        label="购买方名称"
                        min-width="150"
                      ></el-table-column>

                      <el-table-column
                        show-overflow-tooltip
                        prop="remake"
                        label="备注"
                        min-width="100"
                      >
                      </el-table-column>
                    </el-table>
                  </div>
                </template>
              </el-group-title>
            </el-tab-pane>
            <el-tab-pane label="附件" name="e">
              <contractAnnex
                v-if="isTrue"
                ref="attachment"
                isTab
                v-model="fileList"
                state="detail"
              />
            </el-tab-pane>
          </el-tabs>
        </div>
      </div>
      <!--右边审批状态-->
      <approval-read-record
        v-if="approvingBool && isTrue"
        :approvalRecordData="approvalRecordData"
      ></approval-read-record>
    </div>

    <!--  按钮  -->
    <!-- <el-bottom-guide>
      <ul class="ccui-bottom-button">
        <li v-if="$route.query.enterStatus == '审批中'">
          <el-button type="bottom" icon="icon-ccui-reject" @click="handleReset"
            >撤回
          </el-button>
        </li>
        <li
          v-if="
            $route.query.enterStatus == '审批退回' ||
              $route.query.enterStatus == '审批通过'
          "
        >
          <el-button type="bottom" icon="icon-ccui-return" @click="handleBack"
            >返回
          </el-button>
        </li>
      </ul>
    </el-bottom-guide> -->

    <!--  底部导航栏及签名导出  -->
    <!--    发票录入-->
    <bottomGuide
      v-if="isTrue"
      busiType="108"
      :approvalStatus="
        ['5', '22'].includes($route.query.enterApproveStatus)
          ? 'approvaled'
          : ''
      "
      exportMethod="get"
      methodGetPageType="exportInvoiceBasicInfo"
      :curPageId="myId"
      :businessCode="businessCode"
      @handleBack="handleBack"
    />
  </div>
</template>

<script>
import { ishasAgentId } from "@/basa/utils";
import { getInvoceBasicById } from "../api";
import { formatNumber } from "@/basa/utils";
import publicComponent from "@/basa/components/public";
export default {
  name: "invoice_add",
  components: {
    detailBaseInfo: publicComponent.detailBaseInfo,
    approvalReadRecord: publicComponent.approvalRecord,
    contractAnnex: publicComponent.uploadInfo,
    bottomGuide: publicComponent.bottomGuide
  },
  data() {
    return {
      businessCode: "",
      approvalwidth: 0,
      commonStyle: "",
      baseFormList: [
        { label: "填报单位", titleContent: "reportInOrgName" },
        { label: "发票单编号", titleContent: "invoiceCode" },
        { label: "发票单名称", titleContent: "invoiceName" },
        { label: "供应商", titleContent: "partyBName" },
        { label: "结算单编号", titleContent: "settlementCode" },
        { label: "结算单名称", titleContent: "settlementName" },
        { label: "合同编号", titleContent: "contractCode" },
        { label: "合同名称", titleContent: "contractName" },
        { label: "分类名称", titleContent: "categoryName" },
        { label: "币种", titleContent: "currency" },
        { label: "结算金额", titleContent: "settlementAmount" },
        { label: "已收票金额", titleContent: "totalInvoiceAmount" },
        { label: "本次收票金额", titleContent: "currentInvoiceAmount" },
        { label: "发票张数", titleContent: "invoiceNum" },
        { label: "编制人", titleContent: "compileUser" },
        { label: "编制日期", titleContent: "compileDate" },
        {
          label: "备注",
          titleContent: "remark",
          title: true,
          span: 18
        }
      ],
      detailList: {}, //基本信息
      invoiceBillList: [],
      invoiceInfoList: [],
      fileList: [],
      activeName: "a",
      submitFlag: false, // 缓存
      tableBill: [], //发票清单
      billInfo: [], //发票信息
      paymentDetail: [], //款项明细
      approvalRecordData: [],
      myId: "",
      approvingType: {
        1: "approving", // 审批中
        2: "withdrawn", // 已撤回
        3: "approvaled", // 审批通过
        4: "sendback", // 审批退回
        5: "unapproval" // 审批不通过
      },
      approving: "", // 审批状态
      approvingStatus: true, // 审批状态展示
      showBtn: false,
      isTrue: false,
      approvingBool: true,
      amountExcludeTax(row) {
        return Number(row.amountExcludeTax).toFixed(2);
      },
      price(row) {
        return Number(row.price).toFixed(2);
      },
      currentNum(row) {
        return formatNumber(row.currentNum, 3);
      },
      amount(row) {
        return Number(row.amount).toFixed(2);
      },
      tax(row) {
        return Number(row.tax).toFixed(2);
      },
      unitPriceWithoutTax(row) {
        return Number(row.unitPriceWithoutTax).toFixed(2);
      },
      priceTaxTotal(row) {
        return Number(row.priceTaxTotal).toFixed(2);
      }
    };
  },
  // created() {
  //   this.init();
  // },
  methods: {
    handleBack() {
      this.$router.push(
        sessionStorage.getItem("fromPath") || "/invoice/Entering/toSubmit"
      );
      this.isTrue = false;
    },
    // 撤回
    handleReset() {},
    formatDateTime(date) {
      let _time = new Date(date);
      var y = _time.getFullYear();
      var m = _time.getMonth() + 1;
      m = m < 10 ? "0" + m : m;
      var d = _time.getDate();
      d = d < 10 ? "0" + d : d;
      return y + "-" + m + "-" + d;
    },
    getSummaries(param) {
      const { columns, data } = param;
      const sums = [];
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = "合计";
          return;
        }
        if (
          ["currentNum", "amountExcludeTax", "tax", "amount"].includes(
            column.property
          )
        ) {
          const values = data.map(item => Number(item[column.property]));
          if (!values.every(value => isNaN(value))) {
            sums[index] = values.reduce((prev, curr) => {
              const value = Number(curr);
              if (!isNaN(value)) {
                let num = Number(prev) + Number(curr);
                return num;
              } else {
                return Number(prev);
              }
            }, 0);
            if (
              index == 7 ||
              index == 8 ||
              index == 9 ||
              index == 10 ||
              index == 11 ||
              index == 12 ||
              index == 13 ||
              index == 14
            ) {
              if (index == 7) {
                sums[7] = Number(sums[7]).toFixed(3);
              } else {
                sums[index] = Number(sums[index]).toFixed(2);
              }
              //   console.log(sums[index])
            }
          }
        }
      });
      return sums;
    },
    must(obj) {
      if (
        obj.columnIndex == 0 ||
        obj.columnIndex == 1 ||
        obj.columnIndex == 10 ||
        obj.columnIndex == 11
      ) {
        return;
      } else {
        return "must";
      }
    },
    init() {
      const data = {
        id: this.myId
      };
      getInvoceBasicById(data).then(res => {
        this.detailList = res.data.data.invoceBasic;
        this.businessCode = res.data.data.invoceBasic.invoiceCode;
        this.detailList.settlementAmount = Number(
          this.detailList.settlementAmount
        ).toFixed(2);
        this.detailList.totalInvoiceAmount = Number(
          this.detailList.totalInvoiceAmount
        ).toFixed(2);
        this.detailList.currentInvoiceAmount = Number(
          this.detailList.currentInvoiceAmount
        ).toFixed(2);
        // this.detailList.invoiceNum = formatNumber(
        //   this.detailList.invoiceNum,
        //   3
        // );
        this.detailList.compileDate = this.detailList.compileDate
          ? this.detailList.compileDate.substring(0, 10)
          : "";

        this.tableBill = res.data.data.invoceBill; //发票清单
        this.billInfo = res.data.data.invoceInfo; //发票信息
        this.tableBill.forEach(e => {
          e.rate = new this.$BigNumber(Number(e.rate)).multipliedBy(100) + "%";
          e.ratePercent = e.rate;
        });
        
        this.paymentDetail = res.data.data.paymentDetail; // 款项明细
        this.paymentDetail.forEach(e => {
          e.exchangeRate = e.exchangeRate ? e.exchangeRate.toFixed(4) : "";
          e.originalAmount = e.originalAmount
            ? e.originalAmount.toFixed(2)
            : "";
          e.standardAmount = e.standardAmount
            ? e.standardAmount.toFixed(2)
            : "";
          e.dueDate = e.dueDate ? e.dueDate.substring(0, 10) : "";
          e.expectPayDate = e.expectPayDate
            ? e.expectPayDate.substring(0, 10)
            : "";
        });
        // this.billInfo.forEach(e => {
        // e.rate = new this.$BigNumber(Number(e.rate)).multipliedBy(100) + "%";
        // });
        console.log(this.billInfo);
        this.fileList = res.data.data.files; //附件信息
        // this.fileList.forEach(item => {
        //   item.createTime = item.uploadTime;
        // });
        // var fileIds = [];
        // for (let i = 0; i < this.fileList.length; i++) {
        //   fileIds.push(this.fileList[i].fileInfoId);
        // }
        // console.log(this.fileList);
        let resultCommon = res.data.data.invoceBasic.enterApproveStatus === "";
        this.commonStyle = resultCommon
          ? "detail-box ccui-clearfix commonStyle"
          : "detail-box ccui-clearfix";

        if (this.$route.query.type === "approval") {
          this.approvingBool = true;
          this.approvalwidth = `calc(100% - 398px)`;
          let resultCommon =
            res.data.data.invoceBasic.enterApproveStatus === "";
          this.commonStyle = resultCommon
            ? "detail-box ccui-clearfix "
            : "detail-box ccui-clearfix";
        } else {
          this.approvingBool = resultCommon ? false : true;
          this.approvalwidth =
            this.approvingBool == false ? "100%" : "calc(100% - 398px)";
        }
        this.approvalRecordData = res.data.data.approvalRecords; // 审批记录
        this.approvalRecordData.forEach(item => {
          if (item.operState === 0) {
            item.icon = "el-icon-time";
            item.color = "#F5A623";
          }
        });
        this.isTrue = true;
        this.approving =
          this.approvingType[res.data.data.invoceBasic.enterApproveStatus];
        this.approvingStatus = false;
        this.$nextTick(() => {
          this.approvingStatus = true;
        });
      });
    },
    getSummariesInfo(param) {
      const { columns, data } = param;
      const sums = [];
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = "合计";
          return;
        }
        if (
          [
            "priceTaxTotal",
            "deductionRate",
            "amountExcludeTax",
            "tax",
            "deductionTax"
          ].includes(column.property)
        ) {
          const values = data.map(item => Number(item[column.property]));
          if (!values.every(value => isNaN(value))) {
            sums[index] = values.reduce((prev, curr) => {
              const value = Number(curr);
              if (!isNaN(value)) {
                let num = Number(prev) + Number(curr);
                return num;
              } else {
                return Number(prev);
              }
            }, 0);
            if (
              index == 4 ||
              index == 5 ||
              index == 6 ||
              index == 7 ||
              index == 8 ||
              index == 9
            ) {
              sums[index] = Number(sums[index]).toFixed(2);
            }
          }
        }
      });
      // 价税合计=本次收票金额（基本信息）
      return sums;
    }
  },
  filters: {
    filterDate(val) {
      if (val) {
        let filDate = val ? val.substring(0, 10) : "";
        return filDate;
      }
    }
  },
  mounted() {
    console.log(this.$route.query.enterStatus);
  },
  activated() {
    this.myId = this.$route.query.myId;
    this.activeName = "a";
    this.init();
  },

  beforeRouteEnter(to, from, next) {
    !(to.fullPath === from.fullPath) &&
      sessionStorage.setItem("fromPath", from.fullPath);
    next();
  },
  // 更改列表缓存状态
  beforeRouteLeave(to, from, next) {
    if (this.submitFlag === true) {
      for (var key in this.$vnode.parent.parent.componentInstance.cache) {
        delete this.$vnode.parent.parent.componentInstance.cache[
          ishasAgentId(to.path, key)
        ];
      }
    }

    //在被包裹组件停止使用时调用--由于原有方法解决组件缓存有问题，在这里重置附件组件状态
    this.isTrue = false;
    next();
  }
};
</script>

<style scoped lang="scss">
.commonClass {
  margin-top: 5px;
}
// /deep/ .el-table th.must > .cell:before {
//   content: "* ";
//   color: #ff1818;
// }
/deep/ .el-group-title .group-content {
  margin-top: 40px;
}
.approval-read-record {
  margin-top: 0px;
}
// .detail-info {
//   width: calc(100% - 438px);
//   min-height: calc(100vh - 260px);
//   float: left;
//   background: #fff;
//   position: relative;
//   padding: 20px;
// }
// .detail-info-el-Label {
//   position: absolute;
//   width: 107px;
//   right: 33px;
//   top: 31px;
//   z-index: 1;
// }
.commonStyle {
  background: #ffffff;
}
.ccui-app-container-detail {
  background: none;
}
/deep/
  .ccui-form-child-table
  .el-table
  .el-table__footer-wrapper
  tbody
  td:nth-child(1) {
  color: #4a4a4a;
}
/deep/ .el-table__footer-wrapper tbody td {
  font-size: 13px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 600;
  color: #0089ef;
}
/deep/ .ccui-multifunctional-table-wrapper .el-table__header-wrapper th {
  border-right: 1px solid #edf2fc;
}
/deep/ .ccui-multifunctional-table-wrapper .el-table td {
  border-right: 1px solid #edf2fc;
}
/deep/ .el-table__fixed-header-wrapper {
  th {
    pointer-events: auto;
  }
}

/deep/ .el-table__fixed,
/deep/.el-table__fixed-right {
  pointer-events: none;
  td {
    pointer-events: auto;
  }
}
</style>
